#!/bin/bash
mvn compile package
compileResult=$?
if [ $compileResult == 0 ]; then
	echo -e "\033[32m[mvn compile successfully.] \033[0m"
	mvn docker:build
	dockerBuildResult=$?
	if [ $dockerBuildResult == 0 ]; then
		echo -e "\033[32m[docker build successfully.] \033[0m"
       	mvn docker:push
		dockerPushResult=$?
		if [ $dockerPushResult == 0 ]; then
			mvn clean
			echo -e "\033[32m[docker push successfully.] \033[0m"
		else
			echo -e "\033[31m[docker push faild.] \033[0m"
		fi
	else
		echo -e "\033[31m[docker build faild.] \033[0m"
	fi
else
	echo -e "\033[31m[mvn compile faild.] \033[0m"
fi